package com.earthea.chatbot.common.entity;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class BaseReq {
    private Integer pageNum;

    private Integer pageSize;

    private String beginTime;

    private String endTime;

    public boolean isPage() {
        return pageNum != null && pageSize != null && pageNum > 0 && pageSize > 0;
    }

    public Integer getOffset() {
        return isPage() ? (pageNum - 1) * pageSize : -1;
    }

    public Integer getLimit() {
        return isPage() ? pageSize : -1;
    }
}
